<template>
	<view class="cu-list menu"style="border-top: 1px solid #e9dfdf;" >
		<view class="cu-item "  style="min-height: 60px;" @tap="touxiang()">
			<view class="content">
				<text class="text-grey text-lg">头像</text>
			</view>
			<view class="action cuIcon-right-after">
				<view class="cu-avatar-group">
					<view class="cu-avatar  lg" style="background-color: #FFFFFF;">
						<image :src="touxiang1" class="touxiang"></image>
					</view>
				</view>
			</view>
		</view>
		<view class="cu-item cuIcon-right-after" @tap="gonicheng()" >
			<view class="content">
				<text class="text-grey">昵称</text>
			</view>
			<view class="action cuIcon-right-after" style="color: #666666;">
				{{nicheng}}
			</view>
		</view>
		<view class="cu-item cuIcon-right-after"  @tap="gopassword()">
			<view class="content">
				<text class="text-grey">密码</text>
			</view>
			<view class="action cuIcon-right-after" style="color: #666666;">
				
			</view>
		</view>
		<view class="cu-item cuIcon-right-after" @tap="goeditinfo()" v-if="isshow">
			<view class="content">
				<text class="text-grey">修改资料</text>
			</view>
			<view class="action cuIcon-right-after">
			    
			</view>
		</view>
		<!-- <view class="cu-item cuIcon-right-after" >
			<view class="content">
				<text class="text-grey">关于我们</text>
			</view>
			<view class="action cuIcon-right-after">
			
			</view>
		</view> -->
	</view>	
	
</template>

<script>
	import httpPath from '@/static/js/path.js';
	import {getlogin} from '@/static/js/login.js';
	export default {
		data() {
			return {
			    touxiang1:"/static/img/touxiang.png",//头像路径
				nicheng:"昵称",//昵称
			    user:"",//用户信息
				isshow:false,
				
	            
			}
		},
	    onPageScroll(e) {
	    	// //兼容iOS端下拉时顶部漂移
	    	// this.headerPosition = e.scrollTop>=0?"fixed":"absolute";
	    	// this.headerTop = e.scrollTop>=0?null:0;
	    	// this.statusTop = e.scrollTop>=0?null:-this.statusHeight+'px';
	    },
		onShow() {
			this.user = getlogin();
			if(!this.user.islogin){
				uni.showModal({
				   showCancel:false,
				   content:"您还没有登录，请登录"
				})
				uni.navigateTo({
					url:"../public/login"
				})
			}
			if(this.user.type==1){
				this.isshow=true
			}else{
				this.isshow=false;
			}
			this.getinfo();
			
		},
		onLoad() {
			 this.user = getlogin();
			if(!this.user.islogin){
				uni.showModal({
				   showCancel:false,
				   content:"您还没有登录，请登录"
				})
				uni.navigateTo({
					url:"../public/login"
				})
			}
			if(this.user.type==1){
				this.isshow=true
			}else{
				this.isshow=false;
			}
			this.getinfo();
		},
		methods: {
	        // 返回上一步
		
			getinfo(){//获取客户端首页信息
				uni.request({
					url: httpPath.filePath+'/api.php/index/member/member_info/',
					method:'POST',
					header:{'content-type':'application/x-www-form-urlencoded'},
					data: {member_id:this.user.member_id},
					success: (res) => {
						if(res.data.code=="200"){
							this.nicheng=res.data.result.nickname;
							if(res.data.result.headpic!=null&&res.data.result.headpic!=''){
								this.touxiang1=res.data.result.headpic;	
							}
							
						}
						   
					}
				});
				
			},
	        phone () {
	          uni.navigateTo({
	              url:'phone'
	          })  
	        },
	        gopassword() {
	           uni.navigateTo({
	               url:'password'
	           })  
	        },touxiang () {
	           uni.navigateTo({
	               url:'touxiang'
	           })  
	        },
	        gonicheng() {
	            uni.navigateTo({
	               url:'nicheng'
	            })  
	        },goeditinfo(){
				uni.navigateTo({
					url:"edit_info"
				})
			},touxiang(){
				uni.navigateTo({
					url:"touxiang"
				})
			}
		}
	}
</script>

<style lang="scss">
	@import "../../colorui/main.css";
	.page {
		background: #FFFFFF;
		height: 100Vh;
		width: 100vw;
	}
	.cuIcon-right-after:after {
		content: "\e6a3";
		font-size: 16px;
		color: #666666;
	}
    .text-grey{font-size: 14px;color: #333333;}
	.touxiang{width: 100%;height:100%;border-radius:8px;}

</style>
